<form action="<?php echo $PHP_SELF; ?>" method="POST">
<h3>News Entries</h3>
	<div id="searchshow">
		<a href="#" onclick="javascript:toggleVisibility('search');">Show Search</a>
	</div>
	<div id="search" style="display:none;">
	    <a href="#" onclick="javascript:toggleVisibility('search');">Hide Search</a>
		<table id="data">
		<tr><th>Title:</th><td><input type="text" size="30" name="title" value="<?php echo $c->news->title; ?>" /></td></tr>
		<tr><th>Visibility:</th><td><?php echo HtmlUtil::dropdown("visibility", $c->news->visibility); ?></td></tr>
		<tr><td>&nbsp;</td><td><input type="submit" name="action" value="Search" /></td></tr>
		</table>
	</div>
	<br/>
	<?php if (count($c->newsItems) > 0) { ?>
    <table id="results">
     <tr><th>Title</th><th>Create Date</th><th>Visibility</th><th>Tags</th></tr>
    <?php
     foreach ($c->newsItems as $newsItem)
     {
       ?>
       <tr>
       	<td><?php echo HtmlUtil::internalLink("[edit]" , "news", $userRoles, array("action" => "load", "id" => $newsItem->id)); ?>
       	    <?php echo HtmlUtil::internalLink($newsItem->title , "viewNews", $userRoles, array("action" => "load", "id" => $newsItem->id), $newsItem->title); ?></td>
       	<td><?php echo HtmlUtil::formatDate($newsItem->create_date); ?></td>
       	<td><?php echo CodeLookupUtil::getValue("visibility", $newsItem->visibility); ?></td>
       	<td><?php echo implode(", ", NewsLogic::loadTags($newsItem->id)); ?></td>
       </tr>
       <?php
     }
    ?>
    </table>
    <?php } ?>
</form>
